++) and dereference (*) operators).++). But other kinds of iterators are possible. For example, each container type (such as a list) has a specific iterator type designed to iterate through its elements.| category | properties | valid expressions | |||
|---|---|---|---|---|---|
| all categories | copy-constructible, copy-assignable and destructible | X b(a); | |||
| Can be incremented | ++a | ||||
| Random Access | Bidirectional | Forward | Input | Supports equality/inequality comparisons | a == b |
| Can be dereferenced as an rvalue | *a a->m | ||||
| Output | Can be dereferenced as an lvalue (only for mutable iterator types) | *a = t *a++ = t | |||
| default-constructible | X a; X() | ||||
| Multi-pass: neither dereferencing nor incrementing affects dereferenceability | { b=a; *a++; *b; } | ||||
| Can be decremented | --a a-- *a-- | ||||
| Supports arithmetic operators + and - | a + n n + a a - n a - b | ||||
| Supports inequality comparisons (<, >, <= and >=) between iterators | a < b a > b a <= b a >= b | ||||
| Supports compound assignment operations += and -= | a += n a -= n | ||||
| Supports offset dereference operator ([]) | a[n] | ||||